python的if语句怎么写

您所在的位置:网站首页 python if语句多个条件怎么用 python的if语句怎么写

python的if语句怎么写

2022-05-07 03:19| 来源: 网络整理| 查看: 265

1. python的条件语句怎么写(python中sql语句多个查询条件的怎么写)

python的条件语句怎么写(python中sql语句多个查询条件的怎么写)1.python中sql语句多个 查询条件的怎么写

python中有很多字符串连接方式,今天在写代码,顺便总结一下:

1. 最原始的字符串连接方式:str1 + str2

2. python 新字符串连接语法:str1, str2

3. 奇怪的字符串方式:str1 str2

4. % 连接字符串:'name:%s; sex: ' % ('tom', 'male')

5. 字符串列表连接:str.join(some_list)

第四种功能比较强大,借鉴了C语言中 printf 函数的功能,如果你有C语言基础,看下文档就知道了。这种方式用符号“%”连接一个字符串和一组变量,字符串中的特殊标记会被自动用右边变量组中的变量替换。

试试这个

results = self.db.query(

'SELECT LP.Id LineProductId,LP.SupplierLineTitle,LP.MainTitle,LP.SubTitle,LP.ShowTitle ,LPC.CityId DestinationCityId,\

LPC.CityName DestinationCityName,LP.Days,LP.DataFlag,LP.IfDel,LP.RecomImage_Ids AS LineProductRecomImage\

FROM [TCZiZhuYou].dbo.[ZZY_LineProduct] LP WITH(NOLOCK)\

INNER JOIN [TCZiZhuYou].dbo.[ZZY_LineProductCity] LPC WITH(NOLOCK) ON LPC.LineProduct_Id=LP.Id AND LPC.DataFlag=1 AND LPC.IsDestination=1 \

WHERE LP.Id=%d AND LP.LineProductType=%d ' %( line_id, line_type) )[0]

python的条件语句怎么写

转载请注明出处秀迈文化网 » python的if语句怎么写



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3